package com.kaiupup.study.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @projectName: kaiupup-online-taxi
 * @package: com.kaiupup.study.interceptor
 * @className: InterCeptorConfig
 * @author: kaiupup
 * @description: TODO
 * @date: 2024/2/26 12:15
 * @version: 1.0
 */
@Configuration
public class InterCeptorConfig implements WebMvcConfigurer {

    @Bean
    public Jwtinterceptor jwtinterceptor() {
        return new Jwtinterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtinterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/test/**")
                .excludePathPatterns("/verificationCode")
                .excludePathPatterns("/verification-code-check")
                .excludePathPatterns("/error")
        ;
    }
}
